package com.woniuxy.auth.mapper;

import com.woniuxy.auth.entity.Rbac_perm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author user
 * @since 2021-03-03
 */
@Mapper
@Repository
public interface Rbac_permMapper extends BaseMapper<Rbac_perm> {


    @Select("select id,name,code,link,parent_id parentId from v_menu where account=#{account}")
    List<Rbac_perm> getPermsByAccount(String account);


    @Select("select * from v_menu where admin_id=#{id} and type='m'")
    List<Rbac_perm> getMenusById(int id);

    @Select("select * from v_menu where admin_id=#{id} and type='a'")
    List<Rbac_perm> getPermsById(int id);

}
